import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    phonemoney: 1000, 
    phonenumber: 0,
    computermoney: 2000,
    computernumber: 0,
    keyboardmoney: 200,
    keyboardnumber: 0,
    money: 0,
  },
  mutations: {
    increment1(state) {
      state.phonenumber++;
      state.money+=state.phonemoney;
    },
    decrement1(state) {
      state.phonenumber--;
      state.money-=state.phonemoney;
    },
    increment2(state) {
      state.computernumber++;
      state.money+=state.computermoney;
    },
    decrement2(state) {
      state.computernumber--;
      state.money-=state.computermoney;
    },
    increment3(state) {
      state.keyboardnumber++;
      state.money+=state.keyboardmoney;
    },
    decrement3(state) {
      state.keyboardnumber--;
      state.money-=state.keyboardmoney;
    },
  },
  actions: {
  },
  getters: {
    getmoney: state => {
      return state.money;
    },
  },
})
